package com.likersai.funa.pojo.dto.param;

import com.likersai.funa.pojo.dto.req.PageReq;
import lombok.Data;

/**
 * 分页查询入参
 *
 * @author sun.ye
 * @since 2021-07-19 20:51
 */
@Data
public class PageParam {

    private Integer startRow;
    private Integer offset;

    public boolean needPage(){
        return startRow != null && offset != null;
    }

    public void setPage(PageReq req){
        int size = req.getSize();
        int num = req.getNum();
        startRow = ( num - 1 ) * size;
        offset = size;
    }

}